package Day004.ZuoYe01;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) throws ParseException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入生日,格式为yyyy-MM-dd:");
        String birthday = sc.next();

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date1 = sdf.parse(birthday);
        long time1 = date1.getTime(); //生日距离基准时间的毫秒值
        System.out.println(time1);

        Date date2 = new Date(); //创建当前时间
        long time2 = date2.getTime(); //当前距离基准时间的毫秒值
        System.out.println(time2);

        System.out.println("来到世界" + (time2 - time1) / (1000 * 60 * 60 * 24) + "天");

    }
}
